<?php

function uuid() {
    mt_srand ( ( double ) microtime () * 10000 ); //optional for php 4.2.0 and up.随便数播种，4.2.0以后不需要了。
        $charid = strtoupper ( md5 ( uniqid ( rand (), true ) ) ); //根据当前时间（微秒计）生成唯一id.
        $hyphen = chr ( 45 ); // "-"
        $uuid = '' . //chr(123)// "{"
		substr ( $charid, 0, 8 ) . $hyphen . substr ( $charid, 8, 4 ) . $hyphen . substr ( $charid, 12, 4 ) . $hyphen . substr ( $charid, 16, 4 ) . $hyphen . substr ( $charid, 20, 12 );
        //.chr(125);// "}"
        return $uuid;
}

function get_user_dept_list($admin_uuid)
{
	$user_info = M('comm.sys_users')->where("uuid = '$admin_uuid'")->find();
	$admin_dept_list = $user_info['dept_list'];
	$admin_dept_list = explode(',',$admin_dept_list);
	$admin_dept_list_str = "";
	for($i = 0 ; $i < count($admin_dept_list) ; $i++)
	{
		$admin_dept_list_str .= "'";
		$admin_dept_list_str .= $admin_dept_list[$i];
		$admin_dept_list_str .= "'";
		$admin_dept_list_str .= ",";
	}
	$admin_dept_list_str = rtrim($admin_dept_list_str,',');
	return $admin_dept_list_str;
}

?>